﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Data.SqlClient;


namespace finalexam
{
    public partial class Site2 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string strCn = "server=pc.hstc.cn;database=dhd2014112134;uid=2014112134;pwd=19951124";
            SqlConnection cn = new SqlConnection(strCn);
            cn.Open();
            string Tno;
            Tno = Session["Tno"].ToString();
            string strSql = "SELECT   Teacher.Tname FROM UserTea INNER JOIN Teacher ON UserTea.UserName = Teacher.Tno  WHERE   (UserTea.UserName = N'" + Tno+" ')";
            SqlCommand cmd = new SqlCommand(strSql, cn);
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
            {
                this.Label4.Text ="您好："+ dr["Tname"].ToString()+"老师！";
            }
            dr.Close();
            cn.Close();
        }

        protected void Timer1_Tick(object sender, EventArgs e)
        {
            this.Label2.Text = System.DateTime.Now.ToString();
        }

        protected void Timer1_Tick1(object sender, EventArgs e)
        {
            this.Label3.Text = System.DateTime.Now.ToString();
        }
    }
}